import { createRouter, createWebHistory } from "vue-router";
import { routes } from "./routes";
import { resetStaticRoutes } from "../../packages/utils";
import { createRouterGuard } from "./guard";
// import { createRouterGuard } from "./guard";

/**
 *  @zh_CN 创建vue-router实例
 */

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
  scrollBehavior: () => ({ top: 0, left: 0 }),
  // 是否应该禁止尾部斜杠。
  // strict: true,
});

const resetRoutes = () => resetStaticRoutes(router, routes);
// 创建路由守卫
createRouterGuard(router)

export { router, resetRoutes };
